package me.qixiaobo.tran.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import me.qixiaobo.tran.core.handler.TranslationBeanSerializerModifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 翻译模块配置类
 *
 * @author bo
 */
@Slf4j
@Configuration
public class TranslationConfig {
    
    @Autowired
    private ObjectMapper objectMapper;

    @PostConstruct
    public void init() {
     
        // 设置 Bean 序列化修改器
        objectMapper.setSerializerFactory(
            objectMapper.getSerializerFactory()
                .withSerializerModifier(new TranslationBeanSerializerModifier()));
    }

}
